#define _GNU_SOURCE
#include "pthread.h"
#include "unistd.h"
#include <stdio.h>

void *thread1(void *arg)
{
    printf("子线程tid1启动，pid: %d\n", getpid());
    return NULL;
}
void *thread2(void *arg)
{
    printf("子线程tid2启动，pid: %d\n", getpid());
    return NULL;
}

int main(int argc, char const *argv[])
{
    printf("main线程启动，pid: %d\n", getpid());
    pthread_t tid1, tid2;
    pthread_create(&tid1, NULL, thread1, NULL);
    pthread_create(&tid2, NULL, thread2, NULL);
    pthread_join(tid1, NULL);
    pthread_join(tid2, NULL);
    printf("main线程结束，pid: %d\n", getpid());
    return 0;
}

